package com.shilei.decorator;

import com.shilei.GameObject;

import java.awt.*;

/**
 * @description: 矩形装饰
 * @author: 81271
 * @date: 2020-04-16 21:11
 */
public class RectDecorator extends GODecorator{


    public RectDecorator(GameObject gameObject) {
        super(gameObject);
    }

    @Override
    public void paint(Graphics g) {

        gameObject.paint(g);

        Color color = g.getColor();
        g.setColor(Color.WHITE);
        g.drawRect(gameObject.x, gameObject.y, gameObject.getWidth(), gameObject.getHeight());
        g.setColor(color);

    }


    @Override
    public int getHeight() {
        return gameObject.getHeight();
    }

    @Override
    public int getWidth() {
        return gameObject.getWidth();
    }
}
